 /*
  * Copyright (c) 2021, 2023, yishun.cn All rights reserved.
  *
  */
 package cn.shun.config;

 import cn.shun.interceptor.AuthInterceptor;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

 /**
  * <p>Project: sboot_2023-cn.shun.config-WebConfig
  * <p>Powered by yishun On 2023-04-18 10:14:38
  *
  * @author yishun [2465734101@qq.com]
  * @version 1.0
  * @since 17
  */
 @Configuration
 public class WebConfig implements WebMvcConfigurer {
     @Value("${token.Key}")
     private String tokenKey;

     @Override
     public void addInterceptors(InterceptorRegistry registry) {
         registry.addInterceptor(new AuthInterceptor(tokenKey))
                 .addPathPatterns("/**")
                 .order(1)
                 .excludePathPatterns("/api/user/register", "/api/user/login");
     }
 }
